/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author: WJW
 * Date: 2024-08-13
 * Time: 21:40
 */
//工厂类 工厂方法
class Point{
    private double y;
    private double x;
    private double r;
    private double a;

    public static Point makePointByXY(double x, double y){
        Point p = new Point();
        p.setX(x);
        p.setY(y);
        return p;
    }

    public static Point makePointByRA(double r, double a){
        Point p = new Point();
        p.setR(r);
        p.setA(a);
        return p;
    }

    public void setY(double y) {
        this.y = y;
    }

    public double getY() {
        return y;
    }

    public void setX(double x) {
        this.x = x;
    }

    public void setR(double r) {
        this.r = r;
    }

    public void setA(double a) {
        this.a = a;
    }
}

public class Test {
    public static void main(String[] args) {
        Point p = Point.makePointByXY(2,3);
        Point p1 = Point.makePointByRA(2,3);
        System.out.println(p);
        System.out.println(p1);

    }
}
